/<template>
  <div>
    <el-dialog
      title="提示"
      :visible.sync="dialogVisible"
      width="30%"
      :before-close="handleClose"
    >
      <el-form
        :label-position="labelPosition"
        label-width="80px"
        :model="formvalues"
      >
        <div>
          <el-form-item label="姓名">
            <el-input v-model="formvalues.name"></el-input>
          </el-form-item>
          <el-form-item label="账户">
            <el-input v-model="formvalues.user"></el-input>
          </el-form-item>
          <el-form-item label="性别">
            <el-input v-model="formvalues.sex"></el-input>
          </el-form-item>
          <el-form-item label="描述信息">
            <el-input v-model="formvalues.info"></el-input>
          </el-form-item>
          <el-form-item label="日期">
            <el-input v-model="formvalues.date"></el-input>
          </el-form-item>
        </div>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="closeDialog">取 消</el-button>
        <el-button type="primary" @click="sureDialog">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      labelPosition: "right",
      
    };
  },
  mounted() {
    //   this.formvalues=this.$store.state.infodata
  },
  props: {
    handleClose: {
      required: true,
      type: Function,
    },
    dialogVisible: {
      required: true,
      type: Boolean,
    },
    closeDialog: {
      required: true,
      type: Function,
    },
    formvalues:{
        required: true,
      type: Object,
    }
  },
  methods: {
    //   添加数据
    sureDialog() {
      let data = {
        ...this.formvalues,
        id: new Date() * 1,
        flag: false,
      };
      console.log(this.dialogVisible);
      this.closeDialog();
      this.$store.commit("addData", data);
      this.formvalues = {};
    },
    

  },
};
</script>

<style>
</style>